package com.chuang.bootplus.controller.redis;


import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.data.redis.core.RedisTemplate;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

@RestController
@RequestMapping("test")
public class RedisTest {
    //引入操作redis 数据库的模板

    @Autowired
    private RedisTemplate redisTemplate;

    @PostMapping("redis")
    public String test(){
        String a="sda";
        
        //设置值到redis
        redisTemplate.opsForValue().set("set","ams");
        return (String) redisTemplate.opsForValue().get("set");
    }


}
